/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.factory;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import ru.jSkyRoom.factory.BridgeFactory;
import ru.jSkyRoom.interfaces.sub.JSkyLeveledEntry;
import ru.jSkyRoom.interfaces.major.Major;
import skyproc.LeveledEntry;

/**
 *
 * @author Rakev
 */
public class LeveledEntryFactory {

    private static LeveledEntryFactory instance = new LeveledEntryFactory();

    public static LeveledEntryFactory create() {
        return instance;
    }

    protected LeveledEntryFactory() {
    }

    public List<JSkyLeveledEntry> create(Collection<Major> items, int level, int count) {
        List<JSkyLeveledEntry> leveledEntrys = new ArrayList<>(items.size());
        for (Major item : items) {
            JSkyLeveledEntry entry = create(item, level, count);
            leveledEntrys.add(entry);
        }
        return leveledEntrys;
    }

    public List<JSkyLeveledEntry> create(int level, int count, Major... items) {
        List<JSkyLeveledEntry> leveledEntrys = new ArrayList<>(items.length);
        for (Major item : items) {
            JSkyLeveledEntry entry = create(item, level, count);
            leveledEntrys.add(entry);
        }
        return leveledEntrys;
    }

    public JSkyLeveledEntry create(Major item, int level, int count) {
        LeveledEntry rawEntry = new LeveledEntry(item.getForm(), level, count);
        return BridgeFactory.create().createBridge(rawEntry);
    }
}
